package com.cedric.yixianpai.game.cards.Sects.swordCards.b_ZhuJi;

import com.cedric.yixianpai.game.Constants.CardType;
import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 灵犀剑阵
 */
@Component
public class LingXiJianZhen extends SwordCard {
    /**
     * 灵犀剑阵 Shield+9/14/19
     * 耗尽所有剑意，增加等量灵气
     */
    public LingXiJianZhen(@Value("1") int lvl) {
        super("灵犀剑阵");
        this.setPeriod(Period.ZHUJI);
        this.setDescription("护盾+9/14/19 耗尽所有剑意，增加等量灵气");
        this.setCardType(CardType.ZHEN);
        this.setLevel(lvl);
        if(1==lvl){
            this.setShield(9);
        }else if(2==lvl){
            this.setShield(14);
        }else if(3==lvl){
            this.setShield(19);
        }else {
            throw new RuntimeException("卡牌等级错误！");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        Sta1.getPlayerBuff().addShield(this.getShield());
        Sta1.getPlayerBuff().addSpiritualEnergy(Sta1.getPlayerBuff().getSwordIntent());//剑意转为灵气
        System.out.println("耗尽所有剑意，增加等量灵气！");
        Sta1.getPlayerBuff().setSwordIntent(0);
        return true;
    }
}
